clear all;

load('result.mat')

figure('color',[1,1,1],'Position',[20,40,800,760]);


%% curve smooth

subplot(2,2,1);
axis square
plot(x1,y1,'-b','linewidth',2);
hold on
plot([0,2.2],[4.62,4.62],'--b','linewidth',1);
hold on
plot([2.2,2.2],[0,4.62],'--b','linewidth',1);
hold on
plot(2.2,4.62,'ob','linewidth',2);
title('A. Total migration flow (vary $\kappa$)', 'FontSize',15,'Interpreter','Latex');
xlabel('fixed migration cost $\kappa$', 'FontSize',12,'Interpreter','Latex');
ylabel('fraction of households (\%)', 'FontSize',12,'Interpreter','Latex');
set(gca,'FontSize',12);
xlim([1.6,3.4])
xticks(1.6:0.6:3.4)
yticks(0:3:9)
ylim([0,10.5])
text(2.27, 5.4, 'calibrated value', 'FontSize',10,'Interpreter','Latex');

subplot(2,2,2);
axis square
plot(x2,y2,'-b','linewidth',2);
hold on
plot([0,2.2],[0.8925,0.8925],'--b','linewidth',1);
hold on
plot([2.2,2.2],[0.0,0.8925],'--b','linewidth',1);
hold on
plot(2.2,0.8925,'ob','linewidth',2);
title({['B. Ratio of out-migrant share of markets'], ['with/without branches (vary $\kappa$)']}, 'FontSize',15,'Interpreter','Latex');
xlabel('fixed migration cost $\kappa$', 'FontSize',12,'Interpreter','Latex');
ylabel('ratio of out-migrant share', 'FontSize',12,'Interpreter','Latex');
set(gca,'FontSize',12);
xlim([1.6,3.4])
xticks(1.6:0.6:3.4)
ylim([0,1.85])
yticks(0:0.4:1.6)
text(2.25, 0.98, 'calibrated value', 'FontSize',10,'Interpreter','Latex');


subplot(2,2,3);
axis square
plot(x3,y3,'-b','linewidth',2);
hold on
plot([0,0.008],[4.62,4.62],'--b','linewidth',1);
hold on
plot([0.008,0.008],[0,4.62],'--b','linewidth',1);
hold on
plot(0.008,4.62,'ob','linewidth',2);

title('C. Total migration flow (vary $\eta$)', 'FontSize',15,'Interpreter','Latex');
xlabel('taste shock $\eta$', 'FontSize',12,'Interpreter','Latex');
ylabel('fraction of households (\%)', 'FontSize',12,'Interpreter','Latex');
set(gca,'FontSize',12);
xticks(0:0.008:0.024)
xlim([0,0.024])
yticks(0:3:9)
ylim([0,10.5])
% annotation('arrow',[0.5  0.483],[0.2 0.2], 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(0.009, 4.2, 'calibrated value', 'FontSize',10,'Interpreter','Latex');

subplot(2,2,4);
axis square
plot(x4,y4,'-b','linewidth',2);
hold on
plot([0,0.008],[0.8925,0.8925],'--b','linewidth',1);
hold on
plot([0.008,0.008],[0,0.8925],'--b','linewidth',1);
hold on
plot(0.008,0.8925,'ob','linewidth',2);

title({['D. Ratio of out-migrant share of markets'], ['with/without branches (vary $\eta$)']}, 'FontSize',15,'Interpreter','Latex');
xlabel('taste shock $\eta$', 'FontSize',12,'Interpreter','Latex');
ylabel('ratio of out-migrant share', 'FontSize',12,'Interpreter','Latex');
set(gca,'FontSize',12);
% annotation('arrow',[0.78  0.763],[0.2 0.2], 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(0.009, 0.8, 'calibrated value', 'FontSize',10,'Interpreter','Latex');
ylim([0,1.85])
yticks(0:0.4:1.6)
xticks(0:0.008:0.024)
xlim([0,0.024])

